# $Id$
# Maintainer: Jan de Groot <jgc@archlinux.org>

pkgname=libproxy
pkgver=0.4.15
pkgrel=6
pkgdesc="A library that provides automatic proxy configuration management"
arch=(i686 x86_64)
license=('LGPL')
depends=('gcc-libs')
optdepends=('networkmanager: NetworkManager configuration module'
            'perl: Perl bindings'
            'python2: Python 2.x bindings'
            'python: Python 3.x bindings'
            'glib2: gsettings configuration module'
            'webkit2gtk: PAC proxy support (Webkit2gtk engine)')
makedepends=('cmake' 'networkmanager' 'python' 'python2' 'perl' 'webkit2gtk')
url="http://libproxy.github.io/libproxy/"
source=(https://github.com/libproxy/libproxy/archive/${pkgver}.tar.gz)
sha256sums=('18f58b0a0043b6881774187427ead158d310127fc46a1c668ad6d207fb28b4e0')

prepare() {
  if [ ! -d build ]; then
    mkdir build
  fi
}

build() {
  cd build
  cmake ../${pkgname}-${pkgver} \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DLIBEXEC_INSTALL_DIR=/usr/lib/libproxy \
    -DCMAKE_SKIP_RPATH=ON \
    -DPERL_VENDORINSTALL=yes \
    -DCMAKE_BUILD_TYPE=Release \
    -DWITH_WEBKIT3=ON \
    -DWITH_MOZJS=OFF \
    -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
    -DCMAKE_C_FLAGS="${CFLAGS}" \
    -DPYTHON2_EXECUTABLE:FILEPATH=/usr/bin/python2 \
    -DBIPR=0
  make
}

package() {
  cd build
  make DESTDIR="${pkgdir}" install
}
